const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
  mode:'development',
  entry: {
    index:'./src/index.js',
    print:'./src/print.js'
  },
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname,'dist'),
    chunkFilename:'[name].bundle.js',
    clean: true
  },
  devtool: 'inline-source-map',
  devServer: {
    static: './dist',
  },
  plugins:[
    new HtmlWebpackPlugin({
      title: '管理输出'
    })
  ],
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ['style-loader','css-loader']
      },
      {
        test: /\.(png|svg|jpg|jpeg|gif)$/i,
        type: 'asset/resource',
      },
    ]
  }
}